#include <iostream>
#include <future>
#include <thread>
#include <stdio.h>
#include <unistd.h>
#include <string.h>

int add(int a,int b,int c){

    std::cout << "execute add" << std::endl;
    sleep(1);
    return a + b + c;
}
//g++ -std=c++11 async.cpp -o testasync -lpthread
int main(int argc,char* argv[]){
    auto sd = std::async(add,1,2,3);
        //sleep(100);
    std::cout << sd.get() << std::endl;
    char* sp = new char[10];
    strcpy(sp,"helloworld");
    delete[] sp;
    return 0;
}